﻿<UserControl x:Class="Views.ViewGarantiesIncapInval" 
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:System="clr-namespace:System;assembly=mscorlib"
             xmlns:VMtxgar="clr-namespace:OMANE.Modules.TauxGarantis.ViewModels"
             xmlns:Theme="clr-namespace:OMANE.Common.UI.Theme;assembly=OMANE.Common.UI.Theme"
             DataContext="{Binding Source={x:Static VMtxgar:Locator.ViewModelGarantiesIncapInvalStatic}}"
             mc:Ignorable="d">
    
    <UserControl.Resources>
        <HorizontalAlignment x:Key="EntryLabelHorizontalAlignment">Right</HorizontalAlignment>
        <Thickness x:Key="EntryLabelMargin">0,0,5,0</Thickness>
        <VerticalAlignment x:Key="EntryLabelVerticalAlignment">Center</VerticalAlignment>
        <Thickness x:Key="EntryGridMargin">0,2</Thickness>
        <HorizontalAlignment x:Key="EntryValueHorizontalAlignment">Left</HorizontalAlignment>
        <Thickness x:Key="EntryValueMargin">5,0,0,0</Thickness>
        <VerticalAlignment x:Key="EntryValueVerticalAlignment">Center</VerticalAlignment>
        <System:Double x:Key="EntryValueWidth">210</System:Double>
    </UserControl.Resources>
  
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="10"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="10"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <GroupBox Style="{DynamicResource OMANE_GpeBox}" Header="Garanties Incapacité / Invalidité " Margin="10" Grid.ColumnSpan="3" >
            <StackPanel HorizontalAlignment="Center" Margin="0,10" >
                
                <!-- Table de maintien en INCAP / INVAL du modèle 1 -->
                <UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" Height="23.09">
                	<UniformGrid.Visibility>
                		<Binding Path="TableIncapInvalModele1Utilise">
                			<Binding.Converter>
                				<BooleanToVisibilityConverter />
                			</Binding.Converter>
                		</Binding>
                	</UniformGrid.Visibility>
                	<TextBlock Text="Utiliser les tables réglementaire du BCAC ( modèle 1 )" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                	<StackPanel Orientation="Horizontal" Margin="5,0,0,0" Width="{DynamicResource EntryValueWidth}" HorizontalAlignment="Left">
                		<RadioButton Content="Oui" VerticalAlignment="Center" IsChecked="{Binding Path=TablesBCAC, Mode=TwoWay}"/>
                		<RadioButton Content="Non" HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Center" IsChecked="{Binding Path=TablesSpec, Mode=TwoWay}"/>
                	</StackPanel>
                </UniformGrid>
                
                <!-- Table de maintien en INCAP / INVAL du modèle 1 -->
                <UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2">
                    <UniformGrid.Visibility>
                        <Binding Path="TableIncapInvalModele1Utilise">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>
                    <TextBlock Text="Table de maitien en INCAP / INVAL  hors franhise ( modèle 1 )" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <ComboBox 
                        Width="{DynamicResource EntryValueWidth}" 
                        Margin="{DynamicResource EntryValueMargin}" 
                        HorizontalAlignment="{DynamicResource EntryValueHorizontalAlignment}" 
                        VerticalAlignment="{DynamicResource EntryValueVerticalAlignment}" 
                        Style="{DynamicResource OMANE_cbx}" 
                        ItemsSource="{Binding TablesIncapInvalModele1, Mode=OneWay}" 
                        SelectedItem="{Binding TableIncapInvalModele1Selectionne}" IsEnabled="{Binding TablesSpec}">

                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock  Text="{Binding NomTable}" />
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                        <ComboBox.ItemContainerStyle>
                            <Style TargetType="{x:Type ComboBoxItem}">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type ContentControl}">
                                            <TextBlock  Text="{Binding NomTable}" Background="{TemplateBinding Background}" />
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                                <Style.Triggers>
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter Property="Foreground" Value="Red" />
                                    </Trigger>
                                    <Trigger Property="IsHighlighted" Value="True">
                                        <Setter Property="Foreground" Value="White" />
                                        <Setter Property="Background" Value="Violet" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </ComboBox.ItemContainerStyle>
                    </ComboBox>
                </UniformGrid>

                <!-- Table de maintien en INCAP / INVAL du modèle 2 -->
                <UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" >
                    <UniformGrid.Visibility>
                        <Binding Path="TableIncapInvalModele2Utilise">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>
                    <TextBlock Text="Table de maitien en INCAP / INVAL  hors franhise ( modèle 2 )" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <ComboBox 
                        Width="{DynamicResource EntryValueWidth}"
                        Margin="{DynamicResource EntryValueMargin}"
                        HorizontalAlignment="{DynamicResource EntryValueHorizontalAlignment}"
                        VerticalAlignment="{DynamicResource EntryValueVerticalAlignment}" 
                        Style="{DynamicResource OMANE_cbx}" ItemsSource="{Binding TablesIncapInvalModele2, Mode=OneWay}" 
                        SelectedItem="{Binding TableIncapInvalModele2Selectionne}">

                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock  Text="{Binding NomTable}" />
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                        <ComboBox.ItemContainerStyle>
                            <Style TargetType="{x:Type ComboBoxItem}">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type ContentControl}">
                                            <TextBlock  Text="{Binding NomTable}" Background="{TemplateBinding Background}" />
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                                <Style.Triggers>
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter Property="Foreground" Value="Red" />
                                    </Trigger>
                                    <Trigger Property="IsHighlighted" Value="True">
                                        <Setter Property="Foreground" Value="White" />
                                        <Setter Property="Background" Value="Violet" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </ComboBox.ItemContainerStyle>
                    </ComboBox>
                </UniformGrid>

                <!-- Abattements dûs à la franchise à appliquer aux coefficients INCAP /INVAL -->
                <UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" >
                    <UniformGrid.Visibility>
                        <Binding Path="TablesAbattementsFranchise_IsUsed">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>
                    <TextBlock Text="Abattements dus à la franchise à appliquer sur les coefficients INCAP/INVAL" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <ComboBox 
                        Width="{DynamicResource EntryValueWidth}" 
                        Margin="{DynamicResource EntryValueMargin}" 
                        HorizontalAlignment="{DynamicResource EntryValueHorizontalAlignment}" 
                        VerticalAlignment="{DynamicResource EntryValueVerticalAlignment}" 
                        Style="{DynamicResource OMANE_cbx}" SelectedItem="{Binding AbatementsFranchiseSelectionne}" 
                        ItemsSource="{Binding TablesAbatementsFranchise, Mode=OneWay}" IsEnabled="{Binding TablesSpec}" >

                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock  Text="{Binding NomTable}" />
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                        <ComboBox.ItemContainerStyle>
                            <Style TargetType="{x:Type ComboBoxItem}">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type ContentControl}">
                                            <TextBlock  Text="{Binding NomTable}" Background="{TemplateBinding Background}" />
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                                <Style.Triggers>
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter Property="Foreground" Value="Red" />
                                    </Trigger>
                                    <Trigger Property="IsHighlighted" Value="True">
                                        <Setter Property="Foreground" Value="White" />
                                        <Setter Property="Background" Value="Violet" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </ComboBox.ItemContainerStyle>
                    </ComboBox>
                </UniformGrid>

                <!-- Age de fin des garanties INCAP / INVAL -->
                <UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" >
                    <UniformGrid.Visibility>
                        <Binding Path="AgeFinGarantiesIncapInval_IsUsed">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>

                    <TextBlock Text="Age de fin des garanties INCAP/INVAL" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <!--<Theme:NumericEditor Style="{StaticResource AgeEditor}" Value="{Binding Path=AgeFinGarantiesIncapInval}"/>-->
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="{DynamicResource EntryValueHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryValueVerticalAlignment}" DataContext="{Binding AgeFinGarantiesIncapInvalSegmente}">
                        <Theme:NumericEditor Style="{StaticResource AgeEditor}" Value="{Binding UniqueValue}" IsEnabled="{Binding NotUsedSegmentation}" Width="{DynamicResource EntryValueWidth}"/>
                        <RadioButton DataContext="{Binding}" Margin="5" VerticalAlignment="Center" Checked="RadioButton_Checked" GroupName="Segments" IsThreeState="False" IsChecked="{Binding Selected, Mode=TwoWay}" Focusable="False" IsTabStop="False"/>

                        <ToggleButton  Style="{StaticResource SegmentEditorToggleButtonStyle}" IsChecked="{Binding NotUsedSegmentation}" Unchecked="ToggleButton_Unchecked" Focusable="False" IsTabStop="False"  />
                    </StackPanel>
                </UniformGrid>

                <!-- Franchise INCAP (en nombre de mois) -->
                <UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" >
                    <UniformGrid.Visibility>
                        <Binding Path="FranchisesIncapInvalEnNombreDeMois_IsUsed">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>

                    <TextBlock Text="Franchise INCAP ( en nombre de mois )" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <Theme:NumericEditor Style="{StaticResource AgeEditor}" Value="{Binding FranchisesIncapEnNombreDeMois}" Format="0 mois" Width="{DynamicResource EntryValueWidth}"/>
                </UniformGrid>

                <!-- Abattements exclusion maladies non objectivables -->
                <UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" >
                    <UniformGrid.Visibility>
                        <Binding Path="AbattementMaladiesNonObjectivables_IsUsed">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>
                    <TextBlock Text="Abattement exclusion maladies non obectivables" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="{DynamicResource EntryValueHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryValueVerticalAlignment}" DataContext="{Binding AbattementMaladiesNonObjectivables}">
                        <Theme:NumericEditor Style="{StaticResource PercentageEditor}" Value="{Binding UniqueValue}" IsEnabled="{Binding NotUsedSegmentation}" Width="{DynamicResource EntryValueWidth}"/>
                  <RadioButton DataContext="{Binding}" Margin="5" VerticalAlignment="Center" Checked="RadioButton_Checked" GroupName="Segments" IsThreeState="False" IsChecked="{Binding Selected, Mode=TwoWay}" Focusable="False" IsTabStop="False"/>
                        
				        <ToggleButton  Style="{StaticResource SegmentEditorToggleButtonStyle}" IsChecked="{Binding NotUsedSegmentation}" Unchecked="ToggleButton_Unchecked" Focusable="False" IsTabStop="False"  />
                    </StackPanel>
                </UniformGrid>

                <!-- Abattements exclusion perte de revenus -->
                <UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" >
                    <UniformGrid.Visibility>
                        <Binding Path="AbattementExclusionPerteRevenus_IsUsed">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>

                    <TextBlock Text="Abattement exclusion perte de revenus" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="{DynamicResource EntryValueHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryValueVerticalAlignment}" DataContext="{Binding AbattementExclusionPerteRevenus}">
                        <Theme:NumericEditor Style="{StaticResource PercentageEditor}" Value="{Binding UniqueValue}" IsEnabled="{Binding NotUsedSegmentation}" Width="{DynamicResource EntryValueWidth}"/>
                    <RadioButton DataContext="{Binding}" Margin="5" VerticalAlignment="Center" Checked="RadioButton_Checked" GroupName="Segments" IsThreeState="False" IsChecked="{Binding Selected, Mode=TwoWay}" Focusable="False" IsTabStop="False"/>
                        
					    <ToggleButton  Style="{StaticResource SegmentEditorToggleButtonStyle}" IsChecked="{Binding NotUsedSegmentation}" Unchecked="ToggleButton_Unchecked" Focusable="False" IsTabStop="False"  />
                    </StackPanel>
                </UniformGrid>

                <!-- Majoration prudentielle des montants de sinistres incapacité / invalidité -->
                <UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" >
                    <UniformGrid.Visibility>
                        <Binding Path="MajorationPrudentielle_IsUsed">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>

                    <TextBlock Text="Majoration prudentielle des montants de sinistres INCAP/INVAL" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="{DynamicResource EntryValueHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryValueVerticalAlignment}" DataContext="{Binding MajorationPrudentielle}">
                        <Theme:NumericEditor Style="{StaticResource PercentageEditor}" Value="{Binding UniqueValue}" IsEnabled="{Binding NotUsedSegmentation}" Width="{DynamicResource EntryValueWidth}"/>
                  <RadioButton DataContext="{Binding}" Margin="5" VerticalAlignment="Center" Checked="RadioButton_Checked" GroupName="Segments" IsThreeState="False" IsChecked="{Binding Selected, Mode=TwoWay}" Focusable="False" IsTabStop="False"/>
                        
				        <ToggleButton  Style="{StaticResource SegmentEditorToggleButtonStyle}" IsChecked="{Binding NotUsedSegmentation}" Unchecked="ToggleButton_Unchecked" Focusable="False" IsTabStop="False"  />
                    </StackPanel>
                </UniformGrid>

                <!-- Chargement de sécurité lié aux incertitudes sur la table INCAP/INVAL -->
                <UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" >
                    <UniformGrid.Visibility>
                        <Binding Path="ChargementDeSecurite_IsUsed">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>

                    <TextBlock Text="Chargement de sécurité lié aux incertitudes sur la table INCAP/INVAL" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="{DynamicResource EntryValueHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryValueVerticalAlignment}" DataContext="{Binding ChargementDeSecurite}">
                        <Theme:NumericEditor Style="{StaticResource PercentageEditor}" Value="{Binding UniqueValue}" IsEnabled="{Binding NotUsedSegmentation}" Width="{DynamicResource EntryValueWidth}"/>
                    <RadioButton DataContext="{Binding}" Margin="5" VerticalAlignment="Center" Checked="RadioButton_Checked" GroupName="Segments" IsThreeState="False" IsChecked="{Binding Selected, Mode=TwoWay}" Focusable="False" IsTabStop="False"/>
                        
					    <ToggleButton  Style="{StaticResource SegmentEditorToggleButtonStyle}" IsChecked="{Binding NotUsedSegmentation}" Unchecked="ToggleButton_Unchecked" Focusable="False" IsTabStop="False"  />
                    </StackPanel>
                </UniformGrid>

                <!-- Taux mensuel d'entrée en INCAP/ INVA à 0 jours -->
                <UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" >
                    <UniformGrid.Visibility>
                        <Binding Path="TauxMensuelEntreeEnIncapacite_IsUSed">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>

                    <TextBlock Text="Taux mensuel d'entrée en INCAP/ INVA à 0 jours" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="{DynamicResource EntryValueHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryValueVerticalAlignment}" DataContext="{Binding TauxMensuelEntreeEnIncapacite}">
                        <Theme:NumericEditor Style="{StaticResource PercentageEditor}" Value="{Binding UniqueValue}" IsEnabled="{Binding NotUsedSegmentation}" Width="{DynamicResource EntryValueWidth}"/>
                    <RadioButton DataContext="{Binding}" Margin="5" VerticalAlignment="Center" Checked="RadioButton_Checked" GroupName="Segments" IsThreeState="False" IsChecked="{Binding Selected, Mode=TwoWay}" Focusable="False" IsTabStop="False"/>
                        
					    <ToggleButton  Style="{StaticResource SegmentEditorToggleButtonStyle}" IsChecked="{Binding NotUsedSegmentation}" Unchecked="ToggleButton_Unchecked" Focusable="False" IsTabStop="False"  />
                    </StackPanel>
                </UniformGrid>
                
            </StackPanel>
        </GroupBox>
        <GridSplitter HorizontalAlignment="Stretch" Grid.Row="1" Grid.ColumnSpan="3" ResizeDirection="Rows" />
        <GridSplitter ResizeDirection="Columns" HorizontalAlignment="Stretch" Grid.Row="2" Grid.Column="1" />
        <DockPanel Grid.Row="2" 
                    Visibility="Visible" 
                    DataContext="{Binding CurrentSegmentableValue}"
                    >
            <DockPanel.Resources>
                <CollectionViewSource x:Key="VariablesView"  Source="{Binding AvailableVariables}">
                    <CollectionViewSource.GroupDescriptions>
                        <PropertyGroupDescription PropertyName="Type"></PropertyGroupDescription>
                    </CollectionViewSource.GroupDescriptions>
                </CollectionViewSource>
            </DockPanel.Resources>
            <TextBlock TextWrapping="Wrap" Text="Variables de  Segmentation" Margin="5,5,0,5" DockPanel.Dock="Top"/>
            <ListView x:Name="variablesLst" 
                      BorderBrush="{x:Null}"       
                      ItemsSource="{Binding Source={StaticResource VariablesView}}" 
                      DockPanel.Dock="Bottom"
                      HorizontalContentAlignment="Stretch" SelectionMode="Multiple">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Description}" />
                    </DataTemplate>
                </ListView.ItemTemplate>
                <ListView.ItemContainerStyle>
                    <Style TargetType="{x:Type ListViewItem}">
                        <EventSetter Event="UIElement.PreviewMouseLeftButtonDown" Handler="VariableStyle_PreviewMouseLeftButtonDown" />
                        <Setter Property="HorizontalAlignment" Value="Stretch" />
                    </Style>
                </ListView.ItemContainerStyle>
                
                <ListView.GroupStyle>
                    <GroupStyle>
                        <GroupStyle.ContainerStyle>
                            <Style TargetType="{x:Type GroupItem}">
                                <Setter Property="Margin" Value="0,0,0,5"></Setter>
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type GroupItem}">
                                            <Expander IsExpanded="True" BorderBrush="#FFA4B97F" BorderThickness="0,0,0,1">
                                                <Expander.Header>
                                                    <DockPanel>
                                                        <TextBlock FontWeight="Bold" Text="{Binding Path=Name, Converter={StaticResource TypeNameConverter}}"
                                                                   Margin="5,0,0,0" Width="100" />
                                                        <TextBlock FontWeight="Bold" Text="{Binding Path=ItemCount}" />
                                                    </DockPanel>
                                                </Expander.Header>
                                                <Expander.Content>
                                                    <ItemsPresenter />
                                                </Expander.Content>
                                            </Expander>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>

                        </GroupStyle.ContainerStyle>
                    </GroupStyle>
                </ListView.GroupStyle>
                <ListView.View>
                    <GridView>
                        <GridView.Columns>
                            <GridViewColumn Header="                       ">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <Image Margin="0,0,5,0" Source="{Binding Type, Converter={StaticResource TypeNameToIconConverter}}"></Image>
                                            <TextBlock FontWeight="Regular" Text="{Binding Description}"></TextBlock>
                                        </StackPanel>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                        </GridView.Columns>
                    </GridView>
                </ListView.View>
            </ListView>
        </DockPanel>
        <DockPanel 
            Grid.Row="2" 
            Grid.Column="3" 
            DataContext="{Binding CurrentSegmentableValue}" 
            Name="segmentsDockPanel">
            <TextBlock TextWrapping="Wrap"  Margin="5" DockPanel.Dock="Top">
                <TextBlock.Inlines>
                    <Run Text="Paramétrage : " />
                    <Run Text="{Binding Name, FallbackValue=Defaut}" />
                </TextBlock.Inlines>
            </TextBlock>
            <DataGrid                
                DockPanel.Dock="Bottom" 
                AllowDrop="True"  
                ItemsSource="{Binding Table}"
                ColumnWidth="*"
                Drop="DataGrd_Drop"               
                AutoGenerateColumns="True" 
                CanUserAddRows="False" 
                CanUserDeleteRows="False" 
                Name="segmentsGrd"
                >
                <DataGrid.ColumnHeaderStyle>
                    <Style TargetType="{x:Type DataGridColumnHeader}">
                        <Setter Property="VerticalContentAlignment" Value="Center"/>
                        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                        <Setter Property="ContentTemplate">
                            <Setter.Value>
                                <DataTemplate>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="Auto" />
                                        </Grid.ColumnDefinitions>
                                        <TextBlock Grid.Column="0" Text="{Binding}"  HorizontalAlignment="Center" VerticalAlignment="Center" />
                                        <Button Grid.Column="1" 
                                                Content="X" 
                                                Padding="5" 
                                                DataContext="{Binding}" 
                                                Click="DeleteButton_Click"
                                               >
                                            <Button.Visibility>
                                                <Binding RelativeSource="{RelativeSource AncestorType=DataGridColumnHeader}" Path="Column.IsReadOnly" >
                                                    <Binding.Converter>
                                                        <BooleanToVisibilityConverter />
                                                    </Binding.Converter>
                                                </Binding>
                                            </Button.Visibility>
                                        </Button>
                                    </Grid>
                                </DataTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </DataGrid.ColumnHeaderStyle>
               
            </DataGrid>
        </DockPanel>
    </Grid>
</UserControl>
